package org.esgl3d.rendering;

import android.R.integer;

public class VertexFormat {
	
	static final int COLOR = 0;
	static final int NORMAL = 1;
	static final int TEXTURE = 2;
	static final int POSITION = 3;
	
	final int[] components = new int[4];
	final int[] offsets = new int[4];
	
	final int totalFloats;
	final boolean isInterleaved;
	
	private VertexFormat(int setColorComp, int setTextureComp, int setPositionComp, boolean setInterleaved) {
		components[COLOR] = setColorComp;
		components[NORMAL] = 0;
		components[TEXTURE] = setTextureComp;
		components[POSITION] = setPositionComp;
		
		int total = 0;
		for (int i=0;i<4;i++) {
			offsets[i] = 0;
			for (int x=0;x<i;x++)
				offsets[i] += components[x];
			total += components[i];
		}
		
		totalFloats = total;
		isInterleaved = setInterleaved;
	}
	// color, normal, textureX, position
	public static final VertexFormat F_4Color_3Position = new VertexFormat(4, 0, 3,false);
	public static final VertexFormat F_2Texture_3Position = new VertexFormat(0, 2, 3, false);
	public static final VertexFormat F_2Texture_2Position = new VertexFormat(0, 2, 2, false);
}
